<script setup>
import {useRoute, useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import {Message} from "@arco-design/web-vue";
import {getSurveysStatisticsApi, getSurveysSubmitListApi} from "../../apis/SurveysApi.js";
import SubmitListView from "./SubmitListView.vue";
import StatisticsView from "./StatisticsView.vue";
import StatisticsCharts from "../../components/statistics/StatisticsCharts.vue";

const router = useRouter()
const route = useRoute()
const surveyId = ref('')


const tabChange = async (key) => {
    // if (key === '1') {
    //     await getSubmitList()
    // }
    // if (key === '2') {
    //     await getSurveysStatistics()
    // }

}
onMounted(async () => {
    if (route.params.id) {
        surveyId.value = route.params.id

    }else{
        Message.error('id为空')
    }
})

</script>

<template>
    <a-breadcrumb class="pl-2 pt-2">
        <a-breadcrumb-item>首页</a-breadcrumb-item>
        <a-breadcrumb-item>我的问卷</a-breadcrumb-item>
        <a-breadcrumb-item>数据统计</a-breadcrumb-item>
    </a-breadcrumb>

    <a-tabs @change="tabChange" type="card-gutter" lazy-load>
        <a-tab-pane key="1">
            <template #title>
                <icon-code />提交记录
            </template>
            <div class="min-h-[80vh]">
                <SubmitListView :survey-id="surveyId"/>
            </div>

        </a-tab-pane>
        <a-tab-pane key="2">
            <template #title>
                <icon-computer />数据统计
            </template>
            <div class="min-h-[80vh]">
                <StatisticsView :survey-id="surveyId"/>
            </div>
        </a-tab-pane>

    </a-tabs>
</template>

<style scoped>

</style>